import tables, strutils

type Dna = CountTableRef[char]

proc countDna*(dna: string): Dna = 
  if not dna.allCharsInSet({'A', 'G', 'C', 'T'}):
    raise newException(ValueError, "strand with invalid nucleotides")
  newCountTable(dna)

proc getOrDefault*(t: Dna, key: char): int =
  getOrDefault(t, key, 0)